<template>
  <view class="songDetail">
    <view class="songDetail_title">
      <view class="title">
        <text class="title_name">{{ musicInfo.name }}</text>
        <view>
          <text class="title_author" v-for="item in musicInfo.ar" :key="item.id">{{ item.name }}</text>
        </view>
      </view>
    </view>
    <view class="phonogram" @click="isLyric = !isLyric">
      <Hand :isPlay="isPlay" :picUrl="musicInfo.al.picUrl" v-if="!isLyric"></Hand>
      <Lyric :sid="musicInfo.id" v-else></Lyric>
    </view>
    <!-- 播放器 -->
    <view class="phonogram_player">
      <!-- 操作 -->
      <view class="player_top">

      </view>
      <!-- 进度条 -->
      <view class="player_progress">
        <progress :percent="currentTimePercentum" active-color="#fff" backgroundColor="rgba(0,0,0,0.4)"
          stroke-width="2" />
      </view>
      <!-- 播放 -->
      <view class="player_audio">
        <text class="iconfont icon-xunhuan"></text>
        <text class="iconfont icon-shangyiqu" @click="previousSong"></text>
        <view @click="isPlay = !isPlay" class="play">
          <text class="iconfont icon-zanting" v-show="!isPlay"></text>
          <text class="iconfont icon-bofangzhong" v-show="isPlay"></text>
        </view>
        <text class="iconfont icon-xiayiqu" @click="nextSong"></text>
        <text class="iconfont icon-bofangliebiao1"></text>
      </view>
    </view>
  </view>
</template>

<script setup>
  import Hand from './components/Hand/Hand.vue'
  import Lyric from './components/Lyric/Lyric.vue'
  import {
    ref,
    watch
  } from 'vue'
  import {
    storeToRefs
  } from 'pinia'
  import {
    useMusicStore
  } from '@/store/modules/musicStore.js'
  const musicStore = useMusicStore()
  const {
    musicInfo,
    currentTimePercentum,
    isPlay
  } = storeToRefs(musicStore)
  const {
    nextSong,
    previousSong
  } = musicStore
  const isLyric = ref(false)
</script>

<style lang="scss" scoped>
  .songDetail {
    background-color: rgba(0, 0, 0, 0.5);
    /* #ifdef H5 */
    height: 100%;
    /* #endif */
    /* #ifdef MP-WEIXIN */
    height: 100vh;
    /* #endif */
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .songDetail_title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10rpx 20rpx;
      height: 80rpx;
      background-color: rgba(0, 0, 0, 0.1);
      .title {
        display: flex;
        flex: 1;
        flex-direction: column;
        color: #fff;
        justify-content: space-between;
        align-items: center;
        height: 100%;

        .title_name {
          font-size: 30rpx;
          font-weight: bold;
        }

        .title_author {
          font-size: 20rpx;
          opacity: 0.8;
          margin: 0 5rpx;
        }
      }

      .iconfont {
        font-size: 50rpx;
        font-weight: bold;
        color: #fff;
      }
    }

    .phonogram {
      position: relative;
      height: 1000rpx;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .phonogram_player {
      padding: 0 50rpx;

      .player_audio {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 150rpx;

        .play {
          text {
            font-size: 100rpx;
          }
        }

        .iconfont {
          color: #fff;
          font-size: 70rpx;
        }
      }
    }
  }
</style>